package com.hontech.bvapp2.ui.parts.drop

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bvapp2.R
import com.hontech.bvapp2.device.cp.Drop
import com.hontech.bvapp2.ui.dialog.runProg
import com.hontech.bvapp2.utils.onClick

class DropOtherParts (context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_drop_other, this)

        val filmRestart = view.findViewById<Button>(R.id.id_drop_other_film_restart)
        val robotRestart = view.findViewById<Button>(R.id.id_drop_other_robot_restart)
        val film = view.findViewById<Button>(R.id.id_drop_other_film)

        filmRestart.onClick {
            runProg("封膜机", "重启") {
                Drop.filmRestart()
            }
        }

        robotRestart.onClick {
            runProg("机械臂", "重启") {
                Drop.robotRestart()
            }
        }

        film.onClick {
            runProg("封膜", "封膜") {
                Drop.film()
            }
        }
    }
}